alias: Weather - Records, Rain
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.<TOTAL RAIN SENSOR>
condition: []
action:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.<DAILY RAIN SENSOR>
            above: input_number.highest_daily_recorded_rainfall
        sequence:
          - service: input_number.set_value
            data:
              value: "{{states('sensor.<DAILY RAIN SENSOR>')}}"
            target:
              entity_id: input_number.highest_daily_recorded_rainfall
          - service: input_datetime.set_datetime
            data:
              date: "{{ now().date() }}"
            target:
              entity_id: input_datetime.highest_daily_rainfall_date
      - conditions:
          - condition: numeric_state
            entity_id: sensor.<WEEKLY RAIN SENSOR>
            above: input_number.highest_weekly_recorded_rainfall
        sequence:
          - service: input_number.set_value
            data:
              value: "{{states('sensor.<WEEKLY RAIN SENSOR>')}}"
            target:
              entity_id: input_number.highest_weekly_recorded_rainfall
          - service: input_datetime.set_datetime
            data:
              date: "{{ now().date() }}"
            target:
              entity_id: input_datetime.highest_weekly_rainfall_date
      - conditions:
          - condition: numeric_state
            entity_id: sensor.<MONTHLY RAIN SENSOR>
            above: input_number.highest_monthly_recorded_rainfall
        sequence:
          - service: input_number.set_value
            data:
              value: "{{states('sensor.<MONTHLY RAIN SENSOR>')}}"
            target:
              entity_id: input_number.highest_monthly_recorded_rainfall
          - service: input_datetime.set_datetime
            data:
              date: "{{ now().date() }}"
            target:
              entity_id: input_datetime.highest_monthly_rainfall_date
mode: single
